package com.tudouji.project.mt.http.request;

import com.google.gson.reflect.TypeToken;
import com.meituan.sdk.MeituanRequest;
import com.meituan.sdk.MeituanResponse;
import com.meituan.sdk.annotations.ApiMeta;
import com.meituan.sdk.internal.utils.JsonUtil;
import com.tudouji.project.mt.http.response.FoodConsumptionItemResponse;
import com.tudouji.project.mt.http.response.FoodConsumptionResponse;
import lombok.Data;

import java.lang.reflect.Type;

/**
 * 门店_根据单据号查询菜品消耗单明细
 */
@ApiMeta(
        path = "/rms/scmplus/inventory/api/v1/poi/foodConsumption/get",
        businessId = 18,
        apiVersion = "",
        apiName = "",
        needAuth = true
)
@Data
public class FoodConsumptionItemRequest implements MeituanRequest<FoodConsumptionItemResponse> {

    //门店机构Id
    //注：当前机构作为【门店】授权
    private Long orgId;

    //菜品消耗单号
    private String itemSn;

    //消耗类型：
    //1 - 菜品销售
    //2 - 菜品报损
    private Integer consumptionType;

    @Override
    public MeituanResponse<FoodConsumptionItemResponse> deserializeResponse(String response) {
        Type type = new TypeToken<MeituanResponse<FoodConsumptionItemResponse>>(){}.getType();
        return JsonUtil.fromJson(response, type);
    }
    @Override
    public String serializeToJson() {
        return JsonUtil.toJson(this);
    }
}
